package utils;

import domian.Result;
import domian.ResultStatus;

import java.text.SimpleDateFormat;
import java.util.Date;

public class ToolUtil {
    /**
     * 把Date时间转化为String
     *
     * @param date
     * @return
     */
    public static String dateString(Date date) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd  HH:mm:ss");
        return sdf.format(date);
    }

    /**
     * 赋值相应提示信息
     *
     * @param result
     * @param resultStatus
     * @return
     */
    public static Result resultStatus(Result result, ResultStatus resultStatus) {
        result.setCode(resultStatus.getCode());
        result.setMsg(resultStatus.getMsg());
        return result;
    }
}
